package com.dj.mingkong.portal.biz.controller.music.vo.request;

import jakarta.validation.constraints.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.URL;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 音乐文件资源VO
 *
 * @author zenglonghui
 * @date: 2022/10/28 16:52
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class MusicResourceUpdateVo implements Serializable {
    /**
     * 主键
     */
    @NotNull(message = "Id can not be null")
    private Long id;

    /**
     * 价格
     */
    @NotNull(message = "price can not be null")
    @DecimalMax(value = "1000.0", message = "price invalid")
    @DecimalMin(value = "0.0", message = "price invalid")
    @Digits(integer = 4, fraction = 2, message = "price invalid")
    private BigDecimal price;

    /**
     * 音乐URL
     */
    @NotBlank(message = "musicUrl can not be blank")
    @Size(min = 1, max = 230, message = "musicUrl invalid")
    @URL(message = "musicUrl invalid")
    private String musicUrl;

    /**
     * 音质
     */
    @NotBlank(message = "toneKey can not be blank")
    @Size(min = 1, max = 190, message = "toneKey invalid")
    private String toneKey;

    /**
     * 格式
     */
    @NotBlank(message = "format can not be blank")
    @Size(min = 1, max = 190, message = "format invalid")
    private String format;

    /**
     * 音质类型 0标准音质 1高品音质 2无损音质
     */
    @NotNull(message = "toneType can not be null")
    @Max(value = 2, message = "toneType invalid")
    @Min(value = 1, message = "toneType invalid")
    @Positive(message = "toneType invalid")
    private Integer toneType;

    /**
     * 下载类型 0免费下载 1vip下载 2单曲购买
     */
    @NotNull(message = "downloadType can not be null")
    @Max(value = 2, message = "downloadType invalid")
    @Min(value = 0, message = "downloadType invalid")
    @PositiveOrZero(message = "downloadType invalid")
    private Integer downloadType;

}
